Skip to main content

Biometric Capture

Add Biometric Capture to Application

Use the CaptureSessionView to add the required elements to a ViewController

// ViewController.swift
import MobaiCore

let captureSession: CaptureSessionView = {
let captureSession = CaptureSessionView(frame: CGRect.init(x: 0, y: 0, width: 100, height: 100))
captureSession.translatesAutoresizingMaskIntoConstraints = false
captureSession.contentMode = UIView.ContentMode.scaleAspectFill
return captureSession
}()
}

Start Camera Preview

Start the camera preview after the camera permissions are obtained

override func viewDidLoad() {
super.viewDidLoad()
self.captureSession.setupCaptureSession()
}

Start capture session

Start the capture session and wait for the payload

self.captureSessionView.startCaptureSession { (sessionPayload, error) in
if (error != nil) {
// Use session payload
}
}

Configure Capture Session

The capture session can be configured with the following parameters

let captureSession: CaptureSessionView = {
let captureSession = CaptureSessionView(frame: CGRect.init(x: 0, y: 0, width: 100, height: 100))
captureSession.translatesAutoresizingMaskIntoConstraints = false
captureSession.contentMode = UIView.ContentMode.scaleAspectFill
captureSession.encoding = .JPEG
captureSession.faceCaptureEnabled = true
captureSession.numFramesBeforeFaceImage = 9
captureSession.padCaptureEnabled = true
captureSession.targetResolutionPad = .hd1280x720
captureSession.numFramesPad = 5
captureSession.frameInterval = 4
captureSession.faceQualityEnabled = false
return captureSession
}()